/**
 * Copyright (C), 2015-2019, XXX有限公司
 * FileName: FanoutSmsConsumer
 * Author:   pc
 * Date:     2019/9/2 11:16
 * Description: 消费者
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.example.rabbitmqdemo.rabbit;
import com.alibaba.fastjson.JSONObject;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 〈功能：〉<br> 
 * 〈消费者〉
 * @author liuhaoran
 * @create 2019/9/2 11:16
 * @since 1.0.0
 */
@Component
@Controller
public class FanoutSmsConsumer {
	@RabbitListener(queues = "demo_queue")
	public void consumeMessage(Message message) throws Exception{
		String msg = new String(message.getBody(), "UTF-8");
		JSONObject jsonObject = JSONObject.parseObject(msg);
		System.out.println("消费消息：" + jsonObject);
	}
	/*@RabbitListener(queues = "order_information")
	public String selectMsg(Message message) throws  Exception{
		String msg = new String(message.getBody(), "UTF-8");
		JSONObject jsonObject = JSONObject.parseObject(msg);
		System.out.println("消费消息：" + jsonObject);
		return "success";
	}*/
}